package com.zc.study.designPattern.行为型设计模式.MediatorPattern;

import com.fasterxml.jackson.databind.deser.std.MapEntryDeserializer;

public class Test {
    public static void main(String[] args) {
        //定义中介者对象
        ConcreteMediator mediator = new ConcreteMediator();

        //定义同事对象
        Button addBT = new Button();
        List list = new List();
        ComboBox cb = new ComboBox();
        TextBox userNameTB = new TextBox();

        addBT.setMediator(mediator);
        list.setMediator(mediator);
        cb.setMediator(mediator);
        userNameTB.setMediator(mediator);

        mediator.addButton = addBT;
        mediator.list = list;
        mediator.cb = cb;
        mediator.userNameTextBox = userNameTB;

        addBT.changed();
        System.out.println("----------------------------");
        list.changed();

        System.out.println("********************************");

        //定义中介者对象
        SubConcreteMediator mediator1 = new SubConcreteMediator();

        //定义同事对象
        Button addBT1 = new Button();
        List list1 = new List();
        ComboBox cb1 = new ComboBox();
        TextBox userNameTB1 = new TextBox();
        Laber laber = new Laber();

        addBT1.setMediator(mediator1);
        list1.setMediator(mediator1);
        cb1.setMediator(mediator1);
        userNameTB1.setMediator(mediator1);
        laber.setMediator(mediator1);

        mediator1.addButton = addBT1;
        mediator1.list = list1;
        mediator1.cb = cb1;
        mediator1.userNameTextBox = userNameTB1;
        mediator1.laber = laber;

        addBT1.changed();
        System.out.println("----------------------------");
        list1.changed();


    }
}
